//
//  UIViewController+ADUtil.m
//  ADKit
//
//  Created by duzexu on 2017/12/1.
//  Copyright © 2017年 duzexu. All rights reserved.
//

#import "UIViewController+ADUtil.h"

@implementation UIViewController (ADUtil)

+ (instancetype)ad_viewControllerFromXib {
    return [[self alloc] initWithNibName:NSStringFromClass(self) bundle:nil];
}

- (IBAction)ad_navBackAction:(UIButton *)sender {
    if (self.navigationController.childViewControllers.count > 1) {
        [self.navigationController popViewControllerAnimated:YES];
    }else{
        if (self.presentingViewController) {
            [self dismissViewControllerAnimated:YES completion:nil];
        }
    }
}

- (IBAction)ad_navRootAction:(UIButton *)sender {
    [self.navigationController popToRootViewControllerAnimated:YES];
}

@end
